import { LOGN_SHOW_LOADING, LOGIN_IN } from "../../action-types/loginType";
import { httpGet } from "../../utils/fetchUtils";
let url = "cook/category?key=85bc93da0d7855b9e1d1c708145d0c3e";
export function isButtonShow(isLoading) {
  return {
    type: LOGN_SHOW_LOADING,
    isLoading
  };
}
export function login(data, history) {
  return dispatch => {
    dispatch({ type: LOGIN_IN, isLoading: true });
    setTimeout(() => {
      return httpGet(url, function(response) {
        dispatch({
          type: LOGIN_IN,
          result: response,
          isLoading: false
        });
        history.push("/home");
      });
    }, 3000);
  };
}
